<?php

namespace App\Services\Admin;

use App\Models\Classroom as ClassroomModel;

class Classroom extends Base
{
    public static function lists()
    {

        $input = request()->all();

        $where = [];

        if (!empty($input['store_id'])) $where[] = ['store_id', $input['store_id']];
        if (!empty($input['sear_value'])) $where[] = ['numbering', 'like', '%' . $input['sear_value'] . '%'];

        return (new ClassroomModel)->with(['store'])->where($where)->orderBy('id','desc');

    }

    public static function info($id)
    {
        return (new ClassroomModel)->where('id', $id)->first();
    }

    public static function add($param = [])
    {
        return (new ClassroomModel)->insert($param);
    }

    public static function edit($id , $param=[])
    {
        return (new ClassroomModel)->where('id',$id)->update($param);
    }
}
